Part Number Hot Search : 
FM25L04B CXA1479Q 6322F33 C7453 BGA43 SDM0565R 0M106 AWL6254
Product Description
Full Text Search
 

To Download DLP-2232DAQ Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  multi-protocol usb an all-serial data acquisition syst em ? no microcontroller required! **plus ? using fft?s to whistle your way to home automation** don l. powrie introduction the vast majority of usb devices available on the market today have at least one thing in common; they all use microcontrollers to implement the task at hand. whether it?s in the form of a usb serial engine sharing the same piece of silicon with a microcontroller or a simple connection between the two on a printed circuit board, the use of a microcontroller for just about any usb-based ta sk is virtually inescapable?that is, until now. in the arena of "easily-implemented usb", the folks at ftdi ( www. f t d i c h i p . c o m ) have done it yet again by releasing their new, dual-channel ft2232c ic. this new chip offers two interfaces for connection to user electronics as compared to its predecessors (the ft232bm and ft245bm) that only have one. instead of being fixed in hardware as only serial (usb-uart) or parallel (usb-fi fo), both channels of this new chip are configurable for either serial, parallel, or one of several other new interface modes of operation. this article will focus on one of the new inte rface modes known as the ?multi-protocol synchronous serial engine? or mpsse for short. the mpsse interface is only available on one of the two channels and consists of a clock line, a data in line, a data out line, and some general-purpose digital i/o lines. the mpsse can be controlled via any programming language with the ability to open, load, and access a dynamically linked library (dll). i wrote my program in visual c++ to demonstrate the mpsse, but visual basic and other programming languages can be used as well. (we?ll talk more about software later?) i will further demonstrate how to use the mpsse to communicate with a 12-bit a/d converter, a 12-bit dac, 12 digital i/o lines, and control 4 relays, all without the use of a microcontroller?and all without any in-depth knowledge of usb! hardw a re design a printable version of the schematic (figur e 1) is available for download as a *.pdf document from www.dlpdesign.com/usb/2232daq/ . a picture of the prototype prin ted circuit board is shown in figure 2. the picture shows the prototype using the dlp- 2232m, but it could be used with either the dlp-2232m or dlp-2232ml dual-channel usb interface modules. 1
figure 1. schematic the data-acquisition devices used in this design all have serial interfaces; perfect for use with the mpsse. the data in and data out lines of the mpsse are connected at the dlp-2232m(l) interface to form a single, bi-directional data line. this data line and the clock line are shared between all of the acquisition devices in the design, and each device is enabled for communication via one of the general-purpose digital i/o lines on the ft2232c. figure 3 shows a simplified block di agram of the data acquisition system. 2
figure 2. prototype with dlp-2232m ft 2232c a/d dac 16 digit a l i/o li nes re la y k1 re la y k2 re la y k3 re la y k4 cl ock data cs cs cs re la y driv e r ic 4 figure 3. block diagram 3
the a/d is a dual-channel, 12-bit, successive-appr oximation converter that was chosen for its low cost and small size. the intenti on of this hardware design was more to show off the capabilities of the mpsse and less to pr ovide a large-scale or highly accurate data acquisition system. that said, 12 bits (1 .2-millivolt resolution) is likely to be more than enough for most voltage measurem ents on the 0-5 volt range. since the voltage reference for this converter is tied to the vdd line internally, vdd is the reference and can be any value from 4.5-5. 5 volts. since this a/d is communicating digitally with a 5-volt system, taking vdd below 4.5 volts could cause damage and would definitely affect accuracy. in this des ign, the vdd line for the converter is brought out to the interface header via j2, and either the 5-volt supply from the usb port can be used or an external voltage provided through h1. for most applications, the 5-volt power from the usb port should work just fine. the dac employed in this design is also a 12-bit, dual-channel device that has its reference voltage pin brought out to interface header h1. if jumper j3 is set to positions 1 and 2, the output voltage range will be from 0 to approximately 5 volts or whatever the voltage is currently on the usb por t. if jumper j3 is set to positions 2 and 3, then an external reference can be used in t he range of 0-5 volts. for example, if an external voltage reference of 2 volts is used, then the output vo ltage range of the dac will be 0-2 volts with a resolution of 490 microvolts (2.0/4096). the chip used to implement the 12-bit digital i/o bus (also referred to as an i/o ex pander) is a microchip mcp23016, and it can have each of its i/o lines configured as either input or output. since the i/o ex pander does not have a chip select line, an external buffer (u3) was used to prevent the clock line from initiating a reply on the data line while the mpsse is communi cating with another device. the four relays used in this design are spst reed relays, and they require very little current (10ma) to energize their internal 5-volt coil--perfect for usb port-powered applications. they do not need internal pr otection diodes since the uln2003a already has the protection diodes built in. when t he mcp23016 first powers up, its i/o pins are set to input, so 100k pull-down resistors were added to ensure the relays would all be off. ft2232c the best source of information on the ft2232c is, of course, the datasheet. to briefly summarize some of its high points, the two channels of the chip can be individually configured to use either the virtual com port drivers (these make the port look like an rs232 serial port to the host application) or the dll drivers. each channel can be configured for any of the various modes of operation (mpsse is only available on channel a), and these selections are made vi a writing to an eeprom device that is connected to the ft2232c. 4
other new modes of operation for this dev ice are synchronous bit-bang mode, a cpu- style fifo interface mode, mcu host bu s emulation mode, and fast opto-isolated serial interface mode. additionally, a new high-drive level option means that the device uart/fifo io pins will drive out at around th ree times the previous power level, meaning that the bus can be shared by several devices. classic bm-style asynchronous bit-bang mode is also suppor ted, but it has been enhanced to give the user access to the device?s internal rd# and wr# strobes. both channels of the ft2232c are ?full-speed? usb devices, but since there is only a single connection to the host, the combined data throughput for both channels a and b will not exceed a maximum of about 8 megabits per second. the true power of the chip is perfectly illustrated when both channels are used in a design in which a programmable device is rec onfigured in real time ?on the fly?. one example of this would be an fpga conf igured via the mpsse on channel a. once configuration is complete, channel b is then used to communicate with the fpga at full speed. another example would be using t he mpsse to write hex program data to the flash program memory area of a microc ontroller with channel b communicating with the micro at run-time. programming as mentioned earlier, to enable and access the mpsse, you must use ftdi?s dll drivers. visual c++ demo source code t hat demonstrates the use of the dll is available for download from www. d l p d e s i g n . c o m . using the mpsse requires the use of a programming language that can open and access a dll at run-time. the first step in using the dll is to open the dll and load the functions. the application will only be able to do this if the dll drivers have been loaded onto the comput er, and the drivers can only be loaded by connecting an ft2232c usb chip to the computer. once the drivers are properly loaded, the attached u sb chip will appear in device manager under ?universal serial bus controllers?. hint : it? s a good idea to keep device manager open any tim e you are developing a new product around these usb chips just to m a ke certain that windows is properly accessing the hardware. once the dll drivers are opened and loaded, si mple function calls are used to open a communications port and enable the mpsse. to use the mpsse, you begin by setting the speed at which the mpsse will clock out data. you then select a clock/data scheme that works with the connec ted hardware. in the case of our a/d converter, we want commands to be clocked in and conversion results to be clocked out on the rising edge of the clock. mpsse commands 0x 13 and 0x20 will accomplish these tasks. (ftdi app. note an2232c-01 outlines all of the features of the mpsse and is available 5
for download from dlpdesign.com or ftdichip.com .) since the mpsse uses a rather low-level coding method, adding comments to your code is key to understanding what you?ve done the next day when you look at the code again. before the mpsse can communicate with the a/ d, its chip select line (adcs) must be enabled by taking it low. this is accomplished with the command 0x80. following is a short code example (with comments!) fo r enabling communications and performing a single read of the a/d converter: //take adcs low pos=0; tx [pos++] = 0x 80;//setup mpsse low byte i/o lines clear(lowbytehilowstate, adcs );//macro for clearing a bit clear(lowbytehilowstate, clkstate);//start with clock low tx[pos++] = lowbytehilowstate; tx [pos++] = outputmode ; //send control nibble to adc tx [pos++] = 0x 13; //clock out bits, msb first tx[pos++] = 0x03; //3 = 4bits tx[pos++] = ad1; //1111 start, snglch, ch1, msbf //set data direction of ad1 to input tx [pos++] = 0x 80;//setup mpsse low byte i/o lines tx[pos++] = lowbytehilowstate; tx [pos++] = inputmode; //read 2 bytes from a/d conversion tx[pos++] = 0x20;//clock out data, msb first tx[pos++] = 0x01;//lengthl 0=1byte, 1=2bytes tx[pos++] = 0x00;//lengthh //this results in 2 bytes appearing in the rx buffer //take adcs back high tx[pos++] = 0x80; set(lowbytehilowstate, adcs);//take adc enable high tx[pos++] = lowbytehilowstate; tx [pos++] = outputmode; //send the command string write(tx, pos, &ret_bytes); 6
the idea is to build a long stream of comm ands that can be processed at high speed by the mpsse and send them all at once. t he mpsse will process t he entire string of commands at a preset rate and return the dat a requested by that string of commands (if any) to the data buffer on the host that was created when the port was opened. do-re-mi whistle control by now you have likely seen the microphone and preamp circuit (figure 4) and are wondering, ?what am i supposed to do with t hat?? well, now that we have an a/d converter and an mpsse that allows us to sample voltages at a known rate, i thought i?d make a listening device that could not only hear someone whistling 30 feet away but also calculate the frequency of the not e that was being whistled using an fft and perform a specific operation based upon that note. for example, every time you whistle the note for ?do? (remember that movie, t he sound of music? now i?m showing my age?) and hold it for one second, toggle the state of relay k1 to turn on or turn off a fan. or, when you whistle the note for mi, ta ke digital i/o line p01 high, and then turn it off when you whistle the note for fa. figure 4. microphone preamp since middle c on a piano falls somewhere in the 260hz range, you may want to jump up a couple octaves and use the note for c found at about 1040hz. i doubt that anyone can whistle middle c. furthermore, if you whistle do re mi starting at 1040hz, you may find it somewhat challenging to hit that last ?ti? and ?do?. (i cheated a bit and started my do re me at 840hz so that i c ould comfortably whistl e the entire scale--i?m sure julie andrews would be appalled!) also , you don?t have to whistle the exact notes for do, re, and mi. any note you can whistle from about 600hz up to 2khz can be 7
detected by this system due to the sample rate. frequencies below 600hz are ignored in the software since it?s almost impossible to whistle notes this low and these notes tend to appear more prominently in the audi o spectrum when the room is otherwise quiet. if you want to see just what range of frequenc ies your whistler can handle, download the fft based screensaver from www.dlpdesign.com/usb/2232daq/ that listens to a microphone via the sound card in your pc and presents the frequency data in real time. (keep in mind that you shouldn?t use this pr ogram as an actual ?screen saver? because the frame around the image doesn?t change or move and will eventually burn the image onto your crt.) an fft (fast fourier transform) is a mathematical process that converts time domain information to the frequency domain and provides the unique ability to ?listen? to each separate portion of the sampled audio spectrum with perfect clarity. if we acquire 128 voltage samples at a rate of 4,000 samples per second and an fft is calculated, the result of the fft is frequency domain data ev enly divided up into 64 frequency ?bins?. each bin holds a single numeric value that represents the overa ll amplitude of that narrow range (bin) of frequencies. ok, its time for some fft rules: 1. the fft is faster than its predecessor the dft (discrete fourier transform) in part because you must provide 2^n (32, 64, 128, etc.) number of input samples. 2. thanks to work performed back in the 1920?s by henry nyquist, we know that the a/d must sample at a rate (known as the nyquist frequency) that is twice that of the highest frequency we are expecting to find in the frequency domain in order to properly acquire the signal. 3. if the analog signal being sampled has frequency components that are higher than half the sampling rate, then an anti-alia sing filter must be used to filter out these frequencies or the resulting fft output data will be flawed. a filter of this type is typically a low-pass filter fashioned out of op amps, resistors and capacitors. 4. the resulting number of output bins equates to half of the number of input samples. 5. the number of data points taken--not the accuracy of the voltage measurement-- dictates the resolution of the frequency domain data. 6. the accuracy of the frequency domain frequency data (i.e. not the amplitude data) is based on the accuracy of the a/d?s sampling rate. 8
for example : let?s say our a/d is sampling at a rate of 4,000 samples per second and takes 128 voltage measurements from a signal t hat consists of a sine wave oscillating at 1,000hz. if these 128 samples are numbe r-crunched by an fft, the result is 64 frequency domain data points or bins. sinc e we sampled at 4,000hz, the maximum frequency that can be accurately acquired is 2,000hz; and since a single 1,000hz- signal was present in the source , then bin number 32 of the output data will hold a numeric value that is larger than all of the other bins. there are other considerations that have been overlooked such as converting the data in the bins to usable power spectrum dat a (measured in db) and using filters on the source data, but these items are bey ond the scope of this article. now that we have access to frequency domain data and can detect which note is being whistled, all that is left to do is write an application that detects when a particular note (or a note within a specific range) has been held for a second or so and respond accordingly. a windows application can be downloaded from dlpdesign.com that allows the user to set up these conditions and respond in a number of ways. (a screen shot of the program can be seen in figure 5. also, as mentioned earlier, source code for an ex ample program that shows how to access the a/d, dac, relays, and digital i/o lines is available for download. figure 5. whistle detection software 9
10 conclusion there is a considerable amount of reading material available online ( www.dlpdesign.com/pub.shtml ) for those wanting to become familiar with ftdi?s usb chips and drivers. ftdi?s usb ic?s greatly simplify the ta sk of designing a new product utilizing the increasingly popular usb interface, and the ft2232c builds upon that legacy by offering a configurable, two-channel version of their existing product line. ftdi?s usb drivers are quite mature (i.e. well debugged!) and are available for several operating systems. since the drivers are provided royalty free and a micro may not even be required for your application, it?s never been easier to hit the ground running with your new usb-based product design. clearly, usb has a strong hold on the pc market and will remain available for the foreseeable future. personally, i can?t imagine using any other interface!


▲Up To Search▲   

 
Price & Availability of DLP-2232DAQ

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X